using System;
using System.Collections.Generic;

namespace PSSymbolStore
{
    internal class TransactionFileEntry
    {
        private readonly List<string> _fields;

        public TransactionFileEntry(List<string> fields)
        {
            _fields = fields;
        }

        private string GetField(int index)
        {
            if (_fields.Count >= index)
            {
                return _fields[index];
            }
            return String.Empty;
        }

        public string TransactionId
        {
            get { return GetField(TransactionFileParser.TRANSACTION_ID_FIELD); }
        }

        public string TransactionType
        {
            get { return GetField(TransactionFileParser.TRANSACTION_TYPE_FIELD); }
        }

        public string DeletedTransactionId
        {
            get { return GetField(TransactionFileParser.DELETED_TRANSACTION_ID_FIELD); }
        }

        public string TransactionDate
        {
            get { return GetField(TransactionFileParser.TRANSACTION_DATE_FIELD); }
        }

        public string TransactionTime
        {
            get { return GetField(TransactionFileParser.TRANSACTION_TIME_FIELD); }
        }

        public string FileOrPointer
        {
            get { return GetField(TransactionFileParser.FILE_OR_POINTER_FIELD); }
        }

        public string Product
        {
            get { return GetField(TransactionFileParser.PRODUCT_FIELD); }
        }

        public string Version
        {
            get { return GetField(TransactionFileParser.VERSION_FIELD); }
        }

        public string Comment
        {
            get { return GetField(TransactionFileParser.COMMENT_FIELD); }
        }
    }
}
